package com.listening.framework.base.service;

import java.io.Serializable;
import java.util.List;

import com.listening.framework.exception.BusinessException;
import com.listening.framework.utils.Page;
import com.listening.framework.utils.Pagination;

/**
 * Service 基类
 * 
 * @author Listening
 * 
 * @param <DOMAIN>
 * @param <ID>
 */
public abstract class AbstractService<DOMAIN, ENTITY, ID extends Serializable> {

	/**
	 * 插入
	 * 
	 * @param domain
	 * @param id
	 * @return String
	 * @throws BusinessException
	 */
	public abstract String insert(DOMAIN domain, ID id) throws BusinessException;

	/**
	 * 删除
	 * 
	 * @param id
	 * @return Integer
	 * @throws BusinessException
	 */
	public abstract Integer delete(ID id) throws BusinessException;

	/**
	 * 修改对象
	 * 
	 * @param T
	 * @return Integer
	 * @throws BusinessException
	 */
	public abstract Integer modify(DOMAIN domain) throws BusinessException;

	/**
	 * 查询列表
	 * 
	 * @param T
	 * @return List<T>
	 * @throws BusinessException
	 */
	public abstract List<DOMAIN> select(DOMAIN domain) throws BusinessException;

	/**
	 * 主键查询数据
	 * 
	 * @param id
	 * @return T
	 * @throws BusinessException
	 */
	public abstract DOMAIN selectByPK(ID id) throws BusinessException;

	/**
	 * 分页查询
	 * 
	 * @param page
	 * @param T
	 * @return Pagination<T>
	 * @throws BusinessException
	 */
	public abstract Pagination<DOMAIN> selectPageList(Page page, DOMAIN domain) throws BusinessException;

}
